package leetcode_周赛._2021._202105._20210502;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/5/2 10:32
 * 到目标元素的最小距离
 */
public class _5746 {

    public int getMinDistance(int[] nums, int target, int start) {
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < nums.length; i++) {
            if (target == nums[i]) min = Math.min(min, Math.abs(i - start));
        }
        return min;
    }
}
